<script setup lang="ts">
import { useRequest } from 'vue-request'
import { useTestStore } from '@/stores/test'

const count = ref(0)
const Counter = useTestStore()

const { data, loading, run: getapi, error } = useRequest('/api/get', {
  onSuccess: function (data) {
    Counter.inc()
    count.value++
  },
})

const { x, y } = useMouse()
</script>

<template>
  <div>{{ $t('about') }}</div>
  <div>x坐标 {{ x }}</div>
  <div>y坐标 {{ y }}</div>
  <div>{{ count }} | {{ Counter.count }}</div>
  <div>data: {{ JSON.stringify(data) }}</div>
  <div>
    loading: {{ loading }}
    <!-- <Icon icon="mdi:access-point" v-show="!loading" /> -->
  </div>
  <div>error: {{ error }}</div>
  <button type="button" @click="getapi()">发起请求</button>
</template>

<style scoped lang="scss"></style>
